package com.vcit.system.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.vcit.system.mapper.SysBirthdayNoticeMapper;
import com.vcit.system.domain.SysBirthdayNotice;
import com.vcit.system.service.ISysBirthdayNoticeService;

/**
 * 生日提醒通知Service业务层处理
 * 
 * @author vcit
 */
@Service
public class SysBirthdayNoticeServiceImpl implements ISysBirthdayNoticeService
{
    @Autowired
    private SysBirthdayNoticeMapper birthdayNoticeMapper;

    /**
     * 查询生日提醒通知
     * 
     * @param noticeId 通知ID
     * @return 生日提醒通知
     */
    @Override
    public SysBirthdayNotice selectBirthdayNoticeById(Long noticeId)
    {
        return birthdayNoticeMapper.selectBirthdayNoticeById(noticeId);
    }

    /**
     * 查询生日提醒通知列表
     * 
     * @param birthdayNotice 生日提醒通知
     * @return 生日提醒通知
     */
    @Override
    public List<SysBirthdayNotice> selectBirthdayNoticeList(SysBirthdayNotice birthdayNotice)
    {
        return birthdayNoticeMapper.selectBirthdayNoticeList(birthdayNotice);
    }

    /**
     * 新增生日提醒通知
     * 
     * @param birthdayNotice 生日提醒通知
     * @return 结果
     */
    @Override
    public int insertBirthdayNotice(SysBirthdayNotice birthdayNotice)
    {
        return birthdayNoticeMapper.insertBirthdayNotice(birthdayNotice);
    }

    /**
     * 修改生日提醒通知
     * 
     * @param birthdayNotice 生日提醒通知
     * @return 结果
     */
    @Override
    public int updateBirthdayNotice(SysBirthdayNotice birthdayNotice)
    {
        return birthdayNoticeMapper.updateBirthdayNotice(birthdayNotice);
    }

    /**
     * 批量删除生日提醒通知
     * 
     * @param noticeIds 需要删除的通知ID
     * @return 结果
     */
    @Override
    public int deleteBirthdayNoticeByIds(Long[] noticeIds)
    {
        return birthdayNoticeMapper.deleteBirthdayNoticeByIds(noticeIds);
    }

    /**
     * 删除生日提醒通知信息
     * 
     * @param noticeId 通知ID
     * @return 结果
     */
    @Override
    public int deleteBirthdayNoticeById(Long noticeId)
    {
        return birthdayNoticeMapper.deleteBirthdayNoticeById(noticeId);
    }

    /**
     * 检查是否已经发送过生日提醒
     * 
     * @param userId 用户ID
     * @param year 年份
     * @return 是否已发送
     */
    @Override
    public boolean checkNoticeExists(Long userId, int year)
    {
        return birthdayNoticeMapper.checkNoticeExists(userId, year) > 0;
    }
} 